package com.zh.tea.utils;

import java.io.IOException;
import java.io.Reader;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class SessionFactoryUtils {
  
	public static SqlSessionFactory getSqlSessionFactory(){
		Reader reader;
		SqlSessionFactory factory = null;
		try {
			reader = Resources.getResourceAsReader("mybatis-configuration.xml");
			factory = new SqlSessionFactoryBuilder().build(reader);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return factory;
	}
}
